package src;

/**
 * LinkedStack
 */
public class LinkedStack<E> implements Stack<E> {

    private LinkedList<E> list;
    public LinkedStack(){
        list = new LinkedList<E>();
    }


    @Override
    public void push(E e) {
        list.addFirst(e);
    }

    @Override
    public E pop() {
        return list.removeFirst();
    }

    @Override
    public E peek() {
        return list.getFirst();
    }

    @Override
    public int getSize() {
        return list.getSize();
    }

    @Override
    public boolean isEmpyt() {
        return list.isEmpty();
    }
    
    @Override
    public String toString() {
        StringBuilder res = new StringBuilder();
        res.append("Stack <==> ");
        res.append(list);
        return res.toString();
    }
}